package com.tpc.yaoxpt.job;


import com.tpc.yaoxpt.schedule.GoodsScheduleService;
import javafx.concurrent.ScheduledService;
import javafx.util.Duration;

import java.util.concurrent.Executors;

public class GoodsJob {


    ScheduledService<Void> goodsSchedule = null;
    public void execScheduledService(){
        GoodsScheduleService goodsScheduleService = new GoodsScheduleService();
        goodsScheduleService.setExecutor(Executors.newFixedThreadPool(1));
        goodsScheduleService.setDelay(Duration.millis(1000));
        goodsScheduleService.setPeriod(Duration.millis(60000));
        goodsScheduleService.start();
        goodsSchedule = goodsScheduleService;
    }

    public void stopScheduledService(){
        goodsSchedule.cancel();
    }
}
